import { Component, OnInit } from '@angular/core';
import { NavigationEnd, NavigationStart, Router } from '@angular/router';
import * as nProgress from 'nprogress';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.less']
})
export class AppComponent implements OnInit {
  isCollapsed = false;
  ngOnInit(): void { }
  constructor(
    private router: Router,
  ) {
    this.router.events.subscribe(
      router => {
        if (router instanceof NavigationStart) {
          nProgress.start();
        }
        if (router instanceof NavigationEnd) {
          nProgress.done();
        }
      }
    );
  }
}
